From a59464142fb1fe33bcc6e1c20fe659e2557067f1 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 3 Jul 2007 04:03:37 +0000 Subject: [PATCH] Allow stdin on posix gbser filename. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2854 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/gbser_posix.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gpsbabel/gbser_posix.c b/gpsbabel/gbser_posix.c index 15bf4d007..689386ffe 100644 --- a/gpsbabel/gbser_posix.c +++ b/gpsbabel/gbser_posix.c @@ -117,10 +117,14 @@ void *gbser_init(const char *port_name) { h->magic = MYMAGIC; h->vmin = h->vtime = 0; - if (h->fd = open(port_name, O_RDWR | O_NOCTTY), h->fd == -1) { + if (0 == strcmp(port_name, "-") { + h->fd = 0; + return h; + } + else if (h->fd = open(port_name, O_RDWR | O_NOCTTY), h->fd == -1) { gbser__db(1, "Failed to open port (%s)\n", strerror(errno)); - goto failed; - } + goto failed; + } if (!isatty(h->fd)) { gbser__db(1, "%s is not a TTY\n"); -- 2.30.2